package com.xbai.creation.abstractfactory;

import com.xbai.creation.abstractfactory.factory.GUIFactory;
import com.xbai.creation.abstractfactory.product.Button;
import com.xbai.creation.abstractfactory.product.Checkbox;

/**
 * 工厂用户不在乎他们使用哪个具体工厂，因为它们通过抽象接口与工厂和产品一起工作。
 */
public class Application {
    private Button button;
    private Checkbox checkbox;

    public Application(GUIFactory factory) {
        button = factory.createButton();
        checkbox = factory.createCheckbox();
    }

    public void paint() {
        button.paint();
        checkbox.paint();
    }
}